# $也称为结束符或行尾定位符，用于匹配字符串的结尾
import re

pattern = r'World!$'
text = 'Hello, World!'
result = re.search(pattern, text)
if result:
    print("匹配成功:", result.group())
else:
    print("匹配失败")